package com.gzk.oeno.tech.ui.sliders;

import java.awt.Color;
import java.util.Map;

import javax.swing.JComponent;
import javax.swing.JLabel;

public class LabelNullableSlider extends CustomizableNullableSlider{

	private final Map<Integer, String> labels;
	
	public LabelNullableSlider(int min, int max, Map<Integer, String> labels) {
		super(min, max);
		this.labels = labels;
		setupLabels(); // Recall after setting labels
	}

	@Override
	protected JComponent createLabelForIndex(Integer index) {
		if (labels != null && labels.containsKey(index))
			return new JLabel(labels.get(index));
		return null;
	}

	@Override
	protected void updateComponentUIWhenEnabled(JComponent comp, boolean enabled) {
		comp.setForeground(enabled ? Color.black : Color.gray);
	}

}
